package com.ebo.learn_demo

import androidx.annotation.CheckResult
import com.google.gson.Gson
import org.junit.Test
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import java.lang.reflect.Method
import java.nio.ByteBuffer
import java.nio.ByteOrder


/**
 * Example local unit test, which will execute on the development machine (host).
 *
 * See [testing documentation](http://d.android.com/tools/testing).
 */
class ExampleUnitTest {
    @Test
    fun addition_isCorrect() {
        val createMath = MathEngine.createMath<IMathApi>()
        val methodAdd = createMath.methodAdd(1, 2, 3, 4, 5, 6)
        println("methodAdd:$methodAdd")
        println(B())

        parse(javaClass.getDeclaredMethod("testMethod"))
        testMethod()
    }


    fun testMethod(): List<Int>? {
        return null
    }

    fun parse(method: Method) {
        val returnType = method.returnType
        val re = Gson().fromJson("[123456,123456,123456]", returnType)
        println(re)
    }

    init {
        setA()
    }

    private fun setA() {
        a = 5
    }

    var a = 1
}

open class A {
    init {
        setA()
    }

    open fun setA() {
        println("setA")
    }
}

class B : A() {
    val str: String by lazy { "AAAA" }
    override fun setA() {
        var toRegex = str.toRegex()
    }
}